import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.cookman.actions.Action;
import com.cookman.assets.AssetsLocator;
import com.cookman.assets.NullAssests;
import com.cookman.cards.CityCard;
import com.cookman.factories.CitiesFactory;
import com.cookman.gameobjects.CityActor;
import com.cookman.gameobjects.CityCardActor;
import com.cookman.interfaces.IUIController;
import com.cookman.serviceLocators.ServiceLocator;
import com.cookman.world.entities.City;
import com.cookman.world.entities.Disease;
import com.cookman.world.entities.Player;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import static junit.framework.Assert.*;
/**
 * Created by Cookman on 22.12.13.
 */

public class FactoriesTest {

    @Before
    public void before(){
        AssetsLocator.provideAssets(new NullAssests());
    }

    @Test
    public void citiesFactoryTest() {

        ServiceLocator.setUIController(new IUIController() {
            @Override
            public boolean executeAction(Action action) {
                return false;
            }

            @Override
            public Player getCurrentPlayer() {
                return null;
            }

            @Override
            public String getTurnCounter() {
                return "0";
            }

            @Override
            public void selectCity(CityActor cityActor) {

            }

            @Override
            public void resetSelectedCities() {

            }

            @Override
            public void selectDisease(Disease disease) {

            }

            @Override
            public void selectCityCard(CityCardActor cityCardActor) {

            }

            @Override
            public void selectPlayer(Player player) {

            }

            @Override
            public void selectCitiesCards(List<CityCard> cards) {

            }
        });
        City city=new City();
        city.setId("hartum");
        city.setName("Hartum");
        city.setColor("yellow");
        List<City> cities=new ArrayList<>();
        cities.add(city);
        CityActor actor=new CityActor();
        actor.setCity(city);
        actor.setIsActive(true);
        InputEvent e=new InputEvent();
        e.setTarget(actor);
        ((InputListener)actor.getListeners().first()).touchUp(e, 0, 0, 0, 0);
        assertTrue(actor.getIsSelected());
       /* CitiesFactory.loadCities(cities);
        assertTrue(CitiesFactory.getCities().size()>0);*/

    }

}
